import axios from 'axios';

axios.defaults.baseURL = "http://150.158.80.216:8081/server" // 域名
// axios.defaults.baseURL = "http://127.0.0.1:8081/server" // 域名

export const http = axios.create({
  timeout: 1000 * 1000000,
  withCredentials: true,
  BASE_URL: '/api',
  headers: {
    'Content-Type': 'application/json; charset=utf-8'
  }
});

http.interceptors.request.use(function(config){
	return config;
  },function(error){
	return Promise.reject(error);
  });

//添加响应拦截器
http.interceptors.response.use(function(response){
	//对响应数据做些事
	 return response;
  },function(error){
	//请求错误时做些事
	return Promise.reject(error);
  });

export default http
